package com.study.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;

/**
 * @Author wfw
 * @Date 2020/07/12 17:43
 */
@Configuration
public class JpaNoSessionConfig {

    /**
     * 将一个JPAsession与一次完整的请求过程对应的线程相绑定
     * 解决jpa no session问题
     */
    @Bean
    public OpenEntityManagerInViewFilter openEntityManagerInViewFilter(){
        return new OpenEntityManagerInViewFilter();
    }
}
